using System;
using NMock2;
using NUnit.Framework;


namespace NMockExtensions
{
    public abstract class MockingTestFixture
    {
        private Mockery mockery;

        protected virtual IDisposable Ordered
        {
            get { return mockery.Ordered; }
        }

        [SetUp]
        public virtual void MockSetUp()
        {
            mockery = new Mockery();
            SetUp();
        }

        protected abstract void SetUp();

        [TearDown]
        public virtual void MockTearDown()
        {
            TearDown();
            VerifyExpectations();
        }

        protected virtual void TearDown()
        {
        }

        public virtual T NewMock<T>()
        {
            return mockery.NewMock<T>();
        }

        public virtual void VerifyExpectations()
        {
            mockery.VerifyAllExpectationsHaveBeenMet();
        }

        protected static void IgnoreReturnValue(object ignored)
        {
        }
    }
}